<?php
/*
 * 接口：/apply/delete
 * 说明：删除申请
 */

//关闭事物自动提交
$db->mysqlDB->falseAutoCommit();

//获取请求参数
$params = $route->bodyParams;

//更新申请表为取消状态
$P1 = array(
  "update_where" => "oap_id",
  "oap_id" => $params['oap_id'],
  "oap_is_delete" => 1
);

$R1 = $db->mysqlDB->automaticUpdate($P1)->update("easyd_oa_apply_process");

//更新任务流程表的所有状态为取消
$P2 = array(
  "update_where" => "opf_oapid",
  "opf_oapid" => $params['oap_id'],
  "opf_is_delete" => 1
);

$R2 = $db->mysqlDB->automaticUpdate($P2)->update("easyd_oa_process_flow");

//判断是否有出错
if(!$R1 || !$R2){
  $db->mysqlDB->rollBackCommint();
  $db->mysqlDB->trueAutoCommit();
  $response->responseData(false);
}else{
  $db->mysqlDB->actionCommint();
  $db->mysqlDB->trueAutoCommit();
  $response->responseData(true);
}
?>